/*
 * MoveGen.h
 *
 *  Created on: Jun 3, 2011
 *      Author: hongyang
 */

#ifndef MOVEGEN_H_
#define MOVEGEN_H_

#include "../go/Move.h"
#include "../go/RegionBoard.h"
#include "../pattern/PatternMatcher.h"
#include "../mc/mcMain.h"

//const int CHOOSE_MOVE = 20;
//typedef SgArrayList<Move, 20> MoveList;

/**
 * Start game: use patterns.
 * Middle game: mc + evaluation functions.
 */
class MoveListValue{
public:
	MoveListValue(){
	}

	MoveListValue(Move move, int eva){
		this->move = move;
		this->eva = eva;
	}

	 bool operator<(const MoveListValue& value) const{
		 return eva > value.eva;
	 }

	Move move;
	int eva;
};

class MoveGen {
public:
	MoveGen(const RegionBoard& r);
	virtual ~MoveGen();

	void findMoves();
	void genMoveList(SgPoint* plist);
	Move nextMove();
	Move mcNextMove();
	Move killFirst();
	Move fillLast();
	MoveList getMoveList();

private:
	const RegionBoard& regionBoard;
	const Board& board;
	PatternMatcher pm;
	mcMain mc;

	MoveListValue moveList[200];
	int listSize;
};
#endif /* MOVEGEN_H_ */
